{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 猫猫关键词搜索"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [],
   "source": [
    "import requests\n",
    "key =\"5AGZczH538c065ca18b2353370bb64384a85237067281d1\"\n",
    "def catfind(apikey,keyword):\n",
    "    url = 'https://api.apishop.net/common/catFamily/queryCatListByKeyword'\n",
    "    params = {\"apiKey\":key,\n",
    "              \"keyword\":keyword\n",
    "                  }\n",
    "    r = requests.get(url, params=params)\n",
    "    results = r.json()['result']['petFamilyList']\n",
    "    return results\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[{'petID': 8,\n",
       "  'name': '加拿大无毛猫',\n",
       "  'engName': 'Sphynx',\n",
       "  'price': '',\n",
       "  'coverURL': 'http://img.boqiicdn.com/Data/BK/P/img66841406110188.jpg'}]"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "keyword='无毛'\n",
    "catfind(key,keyword)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 植物关键词搜索"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import requests\n",
    "key =\"5AGZczH538c065ca18b2353370bb64384a85237067281d1\"\n",
    "def find(apikey,keyword):\n",
    "    url = 'https://api.apishop.net/common/plantFamily/queryPlantListByKeyword'\n",
    "    params = {\"apiKey\":key,\n",
    "              \"keyword\":keyword\n",
    "                  }\n",
    "    r = requests.get(url, params=params)\n",
    "    results = r.json()['result']['plantList']\n",
    "    return results\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[{'area': '原产墨西哥，现各地广泛栽培',\n",
       "  'coverURL': 'http://img.boqiicdn.com/Data/BK/P/imagick76261443431323.jpg',\n",
       "  'engName': 'Rhipsalidopsis gaertneri',\n",
       "  'name': '假昙花',\n",
       "  'plantID': 305},\n",
       " {'area': '',\n",
       "  'coverURL': 'http://img.boqiicdn.com/Data/BK/P/imagick41971441187207.jpg',\n",
       "  'engName': 'Epiphyllum',\n",
       "  'name': '昙花',\n",
       "  'plantID': 494}]"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "keyword='昙花'\n",
    "find(key,keyword)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 狗狗关键词搜索"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [],
   "source": [
    "import requests\n",
    "key =\"5AGZczH538c065ca18b2353370bb64384a85237067281d1\"\n",
    "def dogfind(apikey,keyword):\n",
    "    url = 'https://api.apishop.net/common/dogFamily/queryDogListByKeyword'\n",
    "    params = {\"apiKey\":key,\n",
    "              \"keyword\":keyword\n",
    "                  }\n",
    "    r = requests.get(url, params=params)\n",
    "    results = r.json()['result']['petFamilyList']\n",
    "    return results\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[{'petID': 133,\n",
       "  'name': '松狮犬',\n",
       "  'engName': 'Chow Chow',\n",
       "  'price': '',\n",
       "  'coverURL': 'http://img.boqiicdn.com/Data/BK/P/img46961406164098.jpg'}]"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "keyword='松狮'\n",
    "dogfind(key,keyword)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 猫猫详细信息搜索"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [],
   "source": [
    "import requests\n",
    "key =\"5AGZczH538c065ca18b2353370bb64384a85237067281d1\"\n",
    "def catmessage(apikey,petID):\n",
    "    url = 'https://api.apishop.net/common/catFamily/queryCatInfo'\n",
    "    params = {\"apiKey\":key,\n",
    "              \"petID\":petID\n",
    "                  }\n",
    "    r = requests.get(url, params=params)\n",
    "    results = r.json()['result']\n",
    "    return results\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'petID': 30,\n",
       " 'name': '科拉特猫',\n",
       " 'engName': 'Korat',\n",
       " 'character': '文静，给人以尊贵、内向的感觉。',\n",
       " 'nation': '泰国 ',\n",
       " 'easyOfDisease': '肠胃疾病',\n",
       " 'life': '10--15岁',\n",
       " 'price': '10000以上',\n",
       " 'des': '1959科拉特猫的体毛和俄罗斯蓝猫、夏多流猫一样，没有浓淡、没有，清一色蓝色。由于没有下层毛的缘故，和体表密着，有像丝一样光泽。同时，一根根毛之间有银灰色插入，可反射光线，使得全身散发出银色的光芒。科拉特原产泰国西北部的考拉特高原，是一个古老品种。此种于年由泰国引入美国，并于年得到美国爱猫者的公认。年后英国方才承认这种猫。又称为，是以其原产地泰国一个省的名字命名，在当地被称为“西塞瓦特”，意为吉祥如意。泰国人常送新娘一对这种代表吉庆的猫作为结婚的传统贺礼。科拉特猫的体毛和俄罗斯蓝猫、夏多流猫一样，没有浓淡、没有斑纹，清一色蓝色。由于没有下层毛的缘故，和体表密着，有像丝一样光泽。同时，一根根毛之间有银灰色插入，可反射光线，使得全身散发出银色的光芒。另外，科拉特猫的另一特色，就是其他猫所没有的心型脸。耳朵大，前端略带圆状，是位于头部较高的位置。绿色的眼睛。又大又圆，稍稍突出。在所有猫之中，拥有最古老的克拉原产地是在泰国西北部的考拉特高原。自古以来泰国人就相信猫能带来幸福，特别是在上流社会中，更被人们所珍重。',\n",
       " 'feature': 'Korat科拉特猫的原产地是泰国，别名：柯拉特、、，英文名：。科拉特猫身材匀称，体格健壮，毛色很独特。平时比较喜欢黏着主人，主人在家陪伴的时候喜欢趴在主人的膝盖上玩耍，是不错的伴侣。：半像矮脚马型，肌肉发达。为鸡心形。：大，尖呈圆弧形。：大而圆，呈晶莹的绿色。：鼻短。：长度适中。：脚爪小，为椭圆形。：长度适中。：毛短而有光泽。：为银蓝色。',\n",
       " 'characterFeature': '科拉特猫的\\n科拉特猫的性格\\n柯拉特猫比较文静，给人以尊贵、内向的感觉。叫声很轻，十分温和，喜欢和人接近。它的智商很高，稍加训练就可以学会拣拾玩具或用双腿走路。考拉特猫与主人的关系亲密，是完美的伴侣动物。科拉特猫生机勃勃，活跃，灵活而贪玩，但不喜滋事喧哗，它需要安静的环境。它对其它猫不友好，对陌生人不信任。它温柔，感情非常丰富，非常敏感，对主人很依恋。需要爱和关注。有着乐音般的嗓子。',\n",
       " 'careKnowledge': '科拉特猫是非常好养的猫咪，它不挑食，没有异食癖，平时的养护也很好打理。科拉特猫属于短毛猫，不像长毛猫掉毛那么厉害，洗澡也比较方便。如果主人在家有时间的话完全可以在家里帮猫咪洗澡，又干净又能亲自帮猫咪洗澡享受乐趣，岂不是一举两得，如果您现在闲着，快快动手吧！',\n",
       " 'feedPoints': '科拉特猫是肉食动物，其实所有的猫咪都爱吃肉，肉类和',\n",
       " 'imageURL': ['http://www.boqii.com/entry/photo/388/0',\n",
       "  'http://www.boqii.com/entry/photo/388/3949',\n",
       "  'http://www.boqii.com/entry/photo/388/3948',\n",
       "  'http://www.boqii.com/entry/photo/388/3947',\n",
       "  'http://www.boqii.com/entry/photo/388/3946',\n",
       "  'http://www.boqii.com/entry/photo/388/3945']}"
      ]
     },
     "execution_count": 38,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "petID='30'\n",
    "catmessage(key,petID)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 狗狗详细信息搜索"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {},
   "outputs": [],
   "source": [
    "import requests\n",
    "key =\"5AGZczH538c065ca18b2353370bb64384a85237067281d1\"\n",
    "def dogmessage(apikey,petID):\n",
    "    url = 'https://api.apishop.net/common/dogFamily/queryDogInfo'\n",
    "    params = {\"apiKey\":key,\n",
    "              \"petID\":petID\n",
    "                  }\n",
    "    r = requests.get(url, params=params)\n",
    "    results = r.json()['result']\n",
    "    return results\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'petID': 133,\n",
       " 'name': '松狮犬',\n",
       " 'engName': 'Chow Chow',\n",
       " 'character': '文静，高雅',\n",
       " 'nation': '中国',\n",
       " 'easyOfDisease': '螨、丝虫病、细小病毒性肠炎、角膜炎、蚤、湿疹、犬脓皮病、过敏性皮炎',\n",
       " 'life': '11-12年',\n",
       " 'price': '',\n",
       " 'des': '一般人看到松狮那张全都堆在一起的囧脸就会觉得它是个憨厚老实，很容易亲近的',\n",
       " 'feature': '松狮犬的腿虽然比较短，但是却肌肉发达，骨骼粗壮，骨量足，厚长的毛让它十分适合在寒冷地区。松狮体格健壮，身体呈方形，短而紧凑，尾根较高，尾巴贴着背部卷起，四肢笔直，强壮有力。被毛厚重，分短毛和粗毛两种，蓝舌头是松狮特有的标志。',\n",
       " 'characterFeature': '松狮喜欢安静，不喜走动，性格也比较高雅，一般不会搞破坏。它的性格更接近于',\n",
       " 'careKnowledge': '松狮有着强健的体格，高雅孤傲的性格，可是养松狮都有一个问题就是它的口水，倒不是因为它的口水量大，而是因为它的“围脖”太厚，口水流出来没地方流，只能全部留在了毛上面，所以松狮清理起来最麻烦的就是沾满口水的嘴巴。刚洗完澡没多久的松狮可能过一会嘴角又会是沾满口水，所以松狮嘴角的的毛最好经常修一修。',\n",
       " 'feedPoints': '因为松狮不喜欢运动，所以对于事物的需求量也并不是特别的大，每天可以给它喂两顿而且不用太多。对于松狮来说皮肤其实并不是特别好，很容易引起皮肤病，所以自己做',\n",
       " 'imageURL': ['http://www.boqii.com/entry/photo/427/0',\n",
       "  'http://www.boqii.com/entry/photo/427/1295',\n",
       "  'http://www.boqii.com/entry/photo/427/1296',\n",
       "  'http://www.boqii.com/entry/photo/427/1297',\n",
       "  'http://www.boqii.com/entry/photo/427/1298',\n",
       "  'http://www.boqii.com/entry/photo/427/1299']}"
      ]
     },
     "execution_count": 35,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "petID='133'\n",
    "dogmessage(key,petID)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 植物详细信息搜索"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "metadata": {},
   "outputs": [],
   "source": [
    "import requests\n",
    "key =\"5AGZczH538c065ca18b2353370bb64384a85237067281d1\"\n",
    "def plantmessage(apikey,plantID):\n",
    "    url = 'https://api.apishop.net/common/plantFamily/queryPlantInfo'\n",
    "    params = {\"apiKey\":key,\n",
    "              \"plantID\":plantID\n",
    "                  }\n",
    "    r = requests.get(url, params=params)\n",
    "    results = r.json()['result']\n",
    "    return results\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'alias': '荷木、木艾树、何树、柯树、木和、回树、木荷柴、横柴',\n",
       " 'binomiaNomenclature': 'Schima superba',\n",
       " 'botanicalName': '木荷',\n",
       " 'careKnowledge': '\\u3000\\u3000\\u3000\\u30001、育苗地选择选择地势平坦，排水良好，土层深厚疏松的酸性沙壤土作圃地。在排水不良的圃地，\\u3000\\u30002、整地、施肥圃地要深耕翻土，使土壤充分风化。施足基肥，用混合\\u3000\\u30003、播种多采用春播，高床，条播，行距20。25cm，播幅10－－15cm，每亩播种量2.5－3kg。幼芽出土力弱，覆土不宜过厚，以0.5cm左右为宜，覆土材料以轻松的沙壤或火烧土为好，要盖一层薄草。\\u3000\\u30004、苗期管理播后2－3周即可发芽，约半数幼苗出土时揭草，搭设荫棚以防日灼和早害，遮阳',\n",
       " 'class': '双子叶植物纲',\n",
       " 'des': '\\u3000\\u3000 \\u3000\\u3000木荷为大乔木，高25米，嫩枝通常无毛。花生于枝顶叶腋，常多朵排成总状花序，直径3厘米，白色，花柄长1－2.5厘米，纤细，无毛；苞片2，贴近萼片，长4－6毫米，早落；萼片半圆形，长2－3毫米，外面无毛，内面有绢毛；花瓣长1－1.5厘米，最外1片风帽状，边缘多少有毛；子房有毛。蒴果直径1.5－2厘米。花期6－8月。',\n",
       " 'engName': 'Schima superba Gardn. et Champ.',\n",
       " 'family': '山茶科',\n",
       " 'feature': '\\u3000\\u3000',\n",
       " 'genus': '木荷属',\n",
       " 'imageURL': ['http://www.boqii.com/entry/photo/2169/0',\n",
       "  'http://www.boqii.com/entry/photo/2169/5359'],\n",
       " 'kingdom': '植物\\u3000',\n",
       " 'latinName': 'Schima superba Gardn. et Champ.',\n",
       " 'name': '木荷',\n",
       " 'order': '侧膜胎座目',\n",
       " 'phylum': '被子植物门',\n",
       " 'plantID': 30,\n",
       " 'species': '木荷种'}"
      ]
     },
     "execution_count": 41,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "plantID='133'\n",
    "plantmessage(key,petID)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.3"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
